package com.model.策略;

public class StrategyPatternDemo {
    public static void main(String[] args) {
        ShoppingCart cart = new ShoppingCart();

        // 使用信用卡支付
        cart.setPaymentStrategy(new CreditCardStrategy("John Doe", "1234567890123456", "123", "12/25"));
        cart.checkout(100);

        // 使用PayPal支付
        cart.setPaymentStrategy(new PaypalStrategy("john@example.com", "password"));
        cart.checkout(50);
    }
}